#pragma once
#include "TypeDefs.h"
#include <map>
#include <boost/random.hpp>
typedef boost::random::mt19937 BR3D_RnEngine;
typedef boost::random::uniform_real_distribution<double> BR3D_Distributor;
typedef boost::variate_generator< boost::random::mt19937, boost::random::uniform_real_distribution<double> > BR3D_Generator;
typedef std::map<int, float*> InnerRandomMapBuffer;
typedef std::map< int, InnerRandomMapBuffer > RandomMapBuffer;
class BufferedRandom3D
{
public:
	BufferedRandom3D(uint xDimension, uint yDimension, uint zDimension, int chunkDimension, int seed);
	~BufferedRandom3D(void);

	//This function takes the untransformed word coordinates 
	float ValueAt(int x, int y, int z);
	//In this function X/Z is just a 2D index of the block
	float* GetBlock(int blockX, int blockZ);
	bool GetBlockContainingChunk(int chunkX, int chunkZ, int *xOut, int *zOut);
	bool BlockExists(int blockX, int blockZ);
private:
	uint m_xSize;
	uint m_ySize;
	uint m_zSize;
	uint m_blockLength;
	uint m_chunkDimension;
	int m_uniqueWorldSeed;
	RandomMapBuffer m_randomBuffer;
};

